$(function() {

    // start datetimepicker use
    $(".js-datetimepicker").datetimepicker({
        autoclose: 1,
        //        pickDate: false
        format: "yyyy-mm-dd-hh:mm:ss",
        //        pickDate: true,
        pickTime: true,
        todayBtn: "linked"
        // pick12HourFormat: true
        // language: "en"
    });

    $(".shiciAdd > button").click(function() {
        var $this = $(".shiciAdd");
        var name = $this.find("input[name=name]").val().trim();
        var title = $this.find("input[name=title]").val().trim();
        var createtime = $this.find("input[name=createtime]").val().trim();
        var author = $this.find('input[name=author]').val().trim();
        var code = $this.find('input[name=passwd]').val().trim();
        var content = $this.find('textarea[name=content]').val().trim();

        var str = "ajax=" + "&name=" + name + "&title=" + title + "&createtime=" +
            createtime + "&author=" + author + "&content=" + content +
            "&jkcode=" + code;
        console.log(str);
        if (name.length <= 0 || title.length <= 0 || content.length <= 0 ||
            code <= 0) {
            alert("请检查名称，副标题，内容和密码是否为空");
            return;
        }
        jk_send_request_post("/shici/AddNew.html", str, shiciResponseAdd)
    });
});

function shiciResponseAdd(data, textStatus) {
    var result = dealSuccess(data, textStatus);
    if (result != true && result != false) {
        alert("Result: " + result.status);
    }
}